
import { Body, Controller, Get, Post } from '@nestjs/common';
import { EmailService } from './email.service';
import { NoAuthGuard } from 'src/guard/Noauth.guard';
import { Throttle } from '@nestjs/throttler';


@Controller('email')
export class EmailController {
    constructor(private emailService: EmailService) {
        console.log("EmailController 创建成功！")
    }
    @NoAuthGuard()
    // 使用限流器，限制接口的访问频率，默认情况下，每个IP每60秒内只能访问5次
    @Throttle({ default: { limit: 5, ttl: 60000 } })
    @Post('/sendCode')
    async sendEmailCode(@Body() data) {
        return this.emailService.sendEmailCode(data);
    }
}
